<?php

use think\facade\Route;

//全局路由变量
Route::pattern([
    'id'    => '\d+',
]);

Route::group(function (){
    Route::post('auth/login', 'Auth@login');
    // 自动刷新jwt
    Route::group(function (){
        Route::get('auth/me', 'Auth@me');
        // 纪念日相关
        Route::get('anniversaries', 'Anniversary@index');
        Route::get('anniversary/latest', 'Anniversary@latestAnniversaries');
        Route::get('anniversary/:id', 'Anniversary@show');
        Route::post('anniversary', 'Anniversary@store');
        Route::put('anniversary/:id', 'Anniversary/update');
        Route::delete('anniversary/:id', 'Anniversary/del');
        // 虚拟对象
        Route::get('dummy', 'Dummy@show');
        Route::post('dummy', 'Dummy@store');
        Route::put('dummy', 'Dummy@update');
        // 恋爱问题
        Route::get('love/questions', 'LoveQuestion@index');
        Route::get('love/question/:id', 'LoveQuestion@show');
        Route::post('love/question/:id/answer', 'LoveQuestion@answer');
        Route::group(function (){
            // 签到相关
            Route::post('sign/daily', 'UserSign@dailySign');    // 每日签到
            Route::get('sign/today/status', 'UserSign@todaySignStatus');    // 每日签到状态
            Route::get('sign/month/status', 'UserSign@queryMothSignData');    // 每月签到状态
            Route::get('sign/days/continue', 'UserSign@continueSignDays');    // 连续签到天数
        })->middleware([
            \app\common\middlewares\CheckUserLover::class  // 该分组下的操作必须绑定TA
        ]);
    })->middleware([
        \thans\jwt\middleware\JWTAuthAndRefresh::class
    ]);
})->prefix('\app\xiangji\controller\\');
